﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace emulib
{
    public enum DatabaseType
    {
        MySQL,
        MSSQL,
        MSSQLCE,
        SQLite,
        /// <summary>
        /// Not to be used normally, used as an unknown database value when strings are given
        /// </summary>
        Null
    }
    enum DatabaseTypeLower
    {
        mysql,
        mssql,
        mssqlce,
        sqlite
    }
    public class DatabaseInfo
    {
        /// <summary>
        /// Supported databases: MySQL, MSSQL, MSSQLCE, and SQLite
        /// </summary>
        public DatabaseType dbType;
        /// <summary>
        /// Supported databases: MySQL, MSSQL, MSSQLCE, and SQLite
        /// </summary>
        public String dbTypeString
        {
            get
            {
                return Enum.GetName(typeof(DatabaseType), (int)dbType);
            }
            set
            {
                try
                {
                    dbType = (DatabaseType)Enum.Parse(typeof(DatabaseTypeLower), value.ToLower());
                }
                catch (Exception)
                {
                    dbType = DatabaseType.Null;
                }
            }
        }
        public String sqlhost;
        public String sqluser;
        public String sqlpass;
        public String sqldb;
        //String is table name, List<DataColumn> is columns in table
        public Dictionary<String, List<DataColumn>> tables;
        //Example table
        //List<DataColumn> ld = new List<DataColumn>();
        //ld.Add(new DataColumn("id", DataType.Integer));
        //ld.Add(new DataColumn("data1", DataType.Text));
        //ld.Add(new DataColumn("testblob", DataType.Blob));
        //dinfo.tables.Add("TestColumn", ld);
    }
}
